package com.xbongbong.pro.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 增值业务类型
 * 创建时间 2019/4/12 8:21 PM
 * 修改时间 2019/4/12 8:21 PM
 * @author chy
 * @since v1.0
 * @version v1.0
 */
@Getter
public enum ValueAddedTypeEnum {
    //短信套餐按以前逻辑，不走缓存
    SMS(2, "sms", "enum.valueAddedType.name.sms"),


    CUSTOM_FORM_NUM(4, "customFormNum", "enum.valueAddedType.name.custom_form_num"),
    TOTAL_FORM_DATA_NUM(5, "totalFormDataNum", "enum.valueAddedType.name.total_form_data_num"),
    ONE_FORM_DATA_NUM(6, "oneFormDataNum", "enum.valueAddedType.name.one_form_data_num"),
    CAPACITY_NUM(7, "capacityNum", "enum.valueAddedType.name.capacity_num"),
    CUSTOM_PROCESS_NUM(8, "customProcessNum", "enum.valueAddedType.name.custom_process_num"),
    CUSTOM_APPLICATION_NUM(9, "customApplicationNum", "enum.valueAddedType.name.custom_application_num"),
    CUSTOM_CHART_NUM(10, "customChartNum", "enum.valueAddedType.name.custom_chart_num"),
    CALL_CENTER(11, "callCenter", "enum.valueAddedType.name.call_center"),
    SEARCH_CUSTOMER(12, "searchCustomer", "enum.valueAddedType.name.search_customer"),
    BUSINESS_SEARCH(13, "businessSearch", "enum.valueAddedType.name.business_search"),
    AI_ASSISTANT(14, "aiAssistant", "enum.valueAddedType.name.ai_assistant"),
    API(15, "api", "enum.valueAddedType.name.api"),
    BUSINESS_RULES(17, "businessRules", "enum.valueAddedType.name.business_rules"),
    ESIGN(18, "esign", "enum.valueAddedType.name.esign"),
    DISTRIBUTOR(20, "distributor", "enum.xbbRefType.name.distributor"),
    /**
     * 19:钻石服务，至尊服务，超级VIP服务
     */
    SERVICE(19, "service", "enum.valueAddedType.name.service"),
    /**
     * 22:xbbcall 坐席费
     */
    XBB_CALL(22, "callSeat","enum.valueAddedType.name.call_seat"),
    /**
     * 24:山海大数据看板
     */
    DATA_KANBAN(24, "dataKanban", "enum.valueAddedType.name.data_kanban"),
    /**
     * 25：云叩
     */
    CLOUD(25, "cloud", "enum.valueAddedType.name.cloud"),
    /**
     * 26：增值服务
     */
    INCREMENT(26, "increment", "enum.valueAddedType.name.increment"),
    /**
     * 27：工作流增值包
     */
    WORKFLOW(27, "workflow", "enum.valueAddedType.name.workflow"),
    /**
     * 搜客增量包
     */
    SEARCH_CUSTOMER_INC_PACKAGE(33, "searchCustomerIncPackage", "enum.valueAddedType.name.searchCustomerIncPackage"),
    /**
     * 公海池高级模式咨询
     */
    PUBLIC_POOL_SENIOR_ASK(34, "publicPoolSeniorAsk", "enum.valueAddedType.name.publicPoolSeniorAsk"),
    /**
     * 28：自定义首页
     */
    HOME_PAGE(28, "customPage", "enum.valueAddedType.name.custom_page"),

    /**
     * 31：数据集
     */
    DATA_SET(31, "dataSet", "enum.valueAddedType.name.data_set"),
    /**
     * 合同比对
     */
    CONTRACT_COMPARE(35, "contractCompare", "enum.valueAddedType.name.contractCompare"),

    /**
     * 32： 新工单标准版
     */
    WORK_ORDER_V2(32, "workOrderV2Package", "enum.valueAddedType.name.workOrderV2"),
    ;

    /**
     * 套餐类型
     */
    private int type;

    /**
     * 应用模板类型名称
     */
    private String alias;
    /**
     * 应用模板类型名称
     */
    private String name;

    ValueAddedTypeEnum(int type, String alias, String name) {
        this.type = type;
        this.alias = alias;
        this.name = name;
    }

    public static ValueAddedTypeEnum getByType(Integer type) {
        for (ValueAddedTypeEnum cache : values()) {

            if (Objects.equals(type, cache.getType())) {
                return cache;
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    public static List<ValueAddedTypeEnum> getValueAddedType() {
        return Arrays.asList(CUSTOM_FORM_NUM, CUSTOM_APPLICATION_NUM, CUSTOM_CHART_NUM, AI_ASSISTANT, BUSINESS_RULES);
    }
}
